home *** CD-ROM | disk | FTP | other *** search
- /* Object Manager Testbed Demo */
-
- #include "objectMgr.h"
-
- EventRecord event; /* event record structure instance */
- EventStuff whatHappened; /* event detail structure instance */
- WindowRecord WR; /* window record structure instance */
- WDHandle tempH;
- WindowPtr myWindow; /* window record structure pointer */
- Rect myRect; /* rectangle data structure instance */
- MenuHandle appleMenu,fileMenu,editMenu;/* handles for standard menus */
-
-
- main()
- {
- Handle objHandle,result;
- char str[256];
- msgArgs args;
-
- XTendInit(); /* Extender initialization routine */
- StdMenus(&appleMenu,&fileMenu,&editMenu); /* set up standard menus */
-
- do {
- do {
- SystemTask(); /* allow for DA handling */
- } while (!XTGetNextEvent(everyEvent,&event)); /* until event occurs */
- HandleEvent(&event,&whatHappened);
-
- switch (whatHappened.ch) {
- case 'n':
- SetRect(&myRect,100,100,350,200);
- tempH = setup_WData(&WR,&myRect,"\PWindowDemo1",0,
- TRUE,TRUE,TRUE,TRUE,TRUE);
- objHandle = _msg(WINDOW,NEW,tempH);
- break;
- case 'h':
- result = msg(HIDE,objHandle);
- break;
- case 's':
- result = msg(SHOW,objHandle);
- break;
- case 'a':
- args.objHndl = objHandle;
- args.objDat1 = ACTIVE;
- result = msg(SET_STATUS,&args);
- result = msg(ACTIVATE,objHandle);
- break;
- case 'g':
- args.objHndl = objHandle;
- args.objDat1 = (LONG)400;
- args.objDat2 = (LONG)300;
- result = msg(GROW,&args);
- break;
- case 'm':
- args.objHndl = objHandle;
- args.objDat1 = (LONG)10;
- args.objDat2 = (LONG)50;
- result = msg(MOVE,&args);
- break;
- case 'd':
- args.objHndl = objHandle;
- args.objDat1 = INACTIVE;
- result = msg(SET_STATUS,&args);
- result = msg(DEACTIVATE,objHandle);
- break;
- case 'k':
- result = msg(FREE,objHandle);
- break;
- case 'c':
- result = msg(CLASS,objHandle);
- NumToString(result,str);
- BugAlert("\Pobject class: ",str,"\P","\P");
- break;
- case 'b':
- result = msg(SIZE,objHandle);
- NumToString(result,str);
- BugAlert("\Pobject data size: ",str,"\P bytes","\P");
- break;
- case 'q':
- result = msg(ASK_STATUS,objHandle);
- NumToString(result,str);
- BugAlert("\Pobject status: ",str,"\P","\P");
- break;
- case '?':
- BugAlert("\Pn,h,s,a,d,k,c,b,q,g,m,? ","\P- commands","\P","\P");
- break;
- }
- } while (ExitRequest(&whatHappened) == FALSE);
- }
-